<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/H-ui.login.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/lib/Hui-iconfont/1.0.9/iconfont.min.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/style.css" />
    <title>后台登录 - 小涴熊漫画CMS</title>
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value="" />
<div class="header"></div>
<div class="loginWraper">
    <div class="loginBox">
        <form class="form form-horizontal" id="form-admin-login" method="post">
            <div class="row clearfix">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                <div class="form-controls col-xs-8">
                    <input name="admin" type="text" placeholder="账户" class="input-text size-L">
                </div>
            </div>
            <div class="row clearfix">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                <div class="form-controls col-xs-8">
                    <input name="password" type="password" placeholder="密码" class="input-text size-L">
                </div>
            </div>
            <div class="row clearfix">
                <div class="form-controls col-xs-8 col-xs-offset-3">
                    <input name="captcha" class="input-text size-L" type="text" placeholder="验证码" style="width:150px;">
                    <img id="img_captcha" src="{:captcha_src()}" onclick = "this.src='captcha?rnd=' + Math.random();">
                </div>
            </div>
            <div class="row clearfix">
                <div class="form-controls col-xs-8 col-xs-offset-3">
                    <input name="" type="submit" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
                    <input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
                </div>
            </div>
        </form>
    </div>
</div>
<div class="footer">Copyright 小涴熊漫画CMS by h-ui.admin.pro.v1.0</div>
{if $cdn == 'bootcdn'}
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validate/1.19.0/jquery.validate.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validate/1.19.0/additional-methods.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-validate/1.19.0/localization/messages_zh.min.js"></script>
{else /}
<script src="https://lib.baomitu.com/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/additional-methods.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/localization/messages_zh.min.js"></script>
{/if}
<script type="text/javascript" src="/static/admin/lib/layer/3.1.1/layer.js"></script>
<script type="text/javascript" src="/static/admin/js/H-ui.min.js"></script>
<script type="text/javascript">
    $(function(){
        /* 表单验证，提交 */
        $("form").validate({
            rules: {
                admin: {
                    required:true,
                },
                password: {
                    required:true,
                    rangelength: [6, 16]
                },
                captcha: {
                    required:true,
                }
            },
            messages: {
                admin: {
                    required: "账户不能为空"
                },
                password: {
                    required: "密码不能为空",
                    rangelength: "密码长度6到16个字符"
                },
                captcha: {
                    required: "验证码不能为空"
                },
            },
            onkeyup: false,
            focusCleanup: false,
            submitHandler: function(form) {
                $.ajax({
                    url:"login/login",
                    type:'post',
                    data:$('form').serialize(),
                    success(res) {
                        if (res.err == 0) {
                            layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                                location.href = "{:url('index/index')}"
                            });
                        } else {
                            layer.msg(res.msg, {icon: 2, time: 1000}, function () {
                                location.reload()
                            });
                        }
                    }
                })
            }
        });
    });
</script>
</body>
</html>
